package com.football.feign.service;


import com.football.feign.entity.User;
import org.hxyjs.page.PageInfo;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.RequestBody;

@Component
public class UserServiceFallbackFactory implements FallbackFactory<UserFeignService>
{
    @Override
    public UserFeignService create(Throwable throwable)
    {
        return new UserFeignService() {
            public String getAllUsers(){
                String message = "网络繁忙，请稍后再试-_-。PS：服务消费者自己提供的信息";
                return message;
            }

            @Override
            public String getUserByUno(String uno) {
                String message = "网络繁忙，这会查询的人太多请稍等";
                return message;
            }
            @PatchMapping("/user") //部分修改
            public String updateUser(@RequestBody User user){
                String message = "网络繁忙，这会查询的人太多请稍等";
                return message;
            }

            @Override
            public String getUsersByPage(@SpringQueryMap PageInfo pageInfo) {
                String message = "网络繁忙，这会查询的人太多请稍等";
                return message;
            }

        };
    }
}
